/**
 * @description 设置本地缓存的键值对
 * @param {*} key 键
 * @param {*} data 值
 */
export function setStorage(key, data) {
  if (data) {
    wx.setStorage({
      key,
      data: data,
    });
  }
}

export function getStorage(key) {
  const data = wx.getStorageSync(key);
  if (!data) return null;
  return data;
}

export function clear() {
  wx.clearStorage();
}
